package com.wisco.web.demo.action;


import java.io.IOException;
import java.io.PrintWriter;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.stereotype.Controller;

import com.wisco.plarform.action.PlatformAction;
import com.wisco.web.demo.model.User;
import com.wisco.web.demo.service.UserService;

@Controller
public class RecordeventAction extends PlatformAction {
	private static final long serialVersionUID = 1L;
	@Resource
	private UserService userService;
	String username;
	String password;
	String qq;
	String phone;
	String alipay;
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getQq() {
		return qq;
	}
	public void setQq(String qq) {
		this.qq = qq;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getAlipay() {
		return alipay;
	}
	public void setAlipay(String alipay) {
		this.alipay = alipay;
	}
	/*
	 * 完成个人注册接口
	 */
	@SuppressWarnings("unchecked")
	@Action(value = "/inviteistory")
	public void inviteHistory() {
		User user = new User();
		user.setAlipay(alipay);
		user.setPassword(password);
		user.setQq(qq);
		user.setUsername(username);
		user.setPhone(phone);
		userService.createUser(user);
		 
	}
	/*
	 * 完成个人查找密码接口
	 */
	@SuppressWarnings("unchecked")
	@Action(value = "/findpwd")
	public void FindPwd() {
		PrintWriter out = null;
		String 		pwd = null;
		try {
			out = (PrintWriter)this.getResponse().getWriter();
		} catch (IOException e) {
			e.printStackTrace();
		}
		 pwd = userService.findPwd(username, phone);
		 out.print("{}");
		 out.flush();
		 out.close();	
	}
	@Override
	public Object getViewModel() {
		// TODO Auto-generated method stub
		return null;
	}
}
